package reflect;

import java.lang.reflect.Field;

public class ReflectDemo8 {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        String s1="abc";
        String s2="abc";
        System.out.println("s1="+s1);
        System.out.println("s2="+s2);
        Class c=String.class;
        Field field=c.getDeclaredField("value");
        field.setAccessible(true);
        field.set(s1,new char[]{'d','e','f'});
        System.out.println("s1="+s1);
        System.out.println("s2="+s2);
        String s3="abc";
        System.out.println("s3="+s3);
    }
}
